import pandas as pd


def convert_csv_to_xlsx(csv_file, xlsx_file):
    # 读取CSV文件
    df = pd.read_csv(csv_file,encoding="utf-8")

    # 将数据写入XLSX文件
    df.to_excel(xlsx_file, index=False)


# 指定CSV文件路径和XLSX文件路径
csv_file = "D:\CodeRepo\python\weibo-search\结果文件\华为\华为.csv"
xlsx_file = "D:\CodeRepo\python\weibo-search\结果文件\华为\华为.xls"

# 调用函数进行转换
convert_csv_to_xlsx(csv_file, xlsx_file)